<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Document</title>
</head>
<body>
    
</body>
<script>

    // 方案一

    function reverseNum(num){
        console.log(typeof num);
        let arr = num.split('')
        arr.reverse()
        return arr.join('')
    }
    let num = prompt('请输入一个数')
    console.log(reverseNum(num));


    // 方案二

    // let num = window.prompt('请输入一个数')
    // let len = num.length
    // for(let i =0;i<len;i++){
    //     document.write(`<strong>${num%10}</strong>`)
    //     num = parseInt(num/10)
    //     if(num == 0){
    //         break
    //     }
    // }
</script>
</html>